import actionsType from './actionsType'
import { getList } from '../api'
const actions = {
  // // 异步 acitons 
  // getList() {
  //   return async (dispatch) => {
  //     const resp = await getList()
  //     dispatch({ type: actionsType.SET_LIST, payload: resp.data.data })
  //   }
  // }
  // 获取列表
  getList(payload) {
    return { type: actionsType.SET_LIST, payload }
  },
  // 加入购物车
  addCar(payload) {
    return { type: actionsType.ADD_CAR_ITEM, payload }
  },
  // 减少购物车
  subCar(payload) {
    return { type: actionsType.SUB_CAR_ITEM, payload }
  },
  // 全选购物车
  allCheck(payload) {
    return { type: actionsType.SWITCH_ALL_CAR_ITEM, payload }
  },
  // 单选购物车
  oneCheck(payload) {
    return { type: actionsType.SWITCH_CAR_ITEM, payload }
  }
}


export default actions